﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr XMLNS:MSHelp = "http://msdn.microsoft.com/mshelp" xmlns:ddue = 
"http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink = 
"http://www.w3.org/1999/xlink" xmlns:tool = "http://www.microsoft.com/tooltip" 
XMLNS:[default] http://ddue.schemas.microsoft.com/authoring/2003/5 = 
"http://ddue.schemas.microsoft.com/authoring/2003/5"><HEAD><TITLE>NetOneway Sample</TITLE>
<META content="text/html; CHARSET=utf-8" http-equiv=Content-Type></META>
<META name=save content=history></META><LINK rel=stylesheet type=text/css 
href="../../../../CommonFiles/Classic.css"></LINK>

<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY>
<DIV id=header>
<TABLE id=topTable width="100%">
  <TBODY>
  <TR id=headerTableRow1>
    <TD align=left><SPAN id=runningHeaderText></SPAN></TD></TR>
  <TR id=headerTableRow2>
    <TD align=left><SPAN id=nsrTitle>NetOneway Sample</SPAN></TD></TR>
  <TR id=headerTableRow3>
    <TD></TD></TR></TBODY></TABLE>
</DIV>
<DIV id=mainSection>
<DIV id=mainBody>
<DIV id=allHistory class=saveHistory onload="loadAll()" 
onsave="saveAll()"></DIV>
<P>This sample demonstrates how to expose and consume a service endpoint using 
the <B>NetOnewayRelayBinding</B> binding. </P>
<H2 class=heading>Prerequisites</H2>
<DIV id=sectionSection0 class=section><content 
xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
<P xmlns="">If you haven't already done so, please read the release notes 
document that explains how to sign up for a Windows Azure account and 
how to configure your environment. 
</P></content></DIV>
<H2 class=heading>Service</H2>
<DIV id=sectionSection1 class=section><content 
xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
<P xmlns="">The service and client both use the following simple contract:</P>
<DIV class=code xmlns=""><SPAN codeLanguage="CSharp">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
  <TBODY>
  <TR>
    <TH>C#&nbsp;</TH>
</TR>
  <TR>
    <TD colSpan=2><PRE>[ServiceContract(Name = "IOnewayContract", Namespace = "http://samples.microsoft.com/ServiceModel/Relay/")]
    public interface IOnewayContract
    {
        [OperationContract(IsOneWay = true)]
        void Send(int count);
    } 
</PRE></TD></TR></TBODY></TABLE></SPAN></DIV>
<P xmlns="">The endpoints for this service are defined in the application 
configuration file, as follows:</P>
<DIV class=code xmlns=""><SPAN codeLanguage="xml">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
  <TBODY>
  <TR>
    <TH>Xml&nbsp;</TH>
</TR>
  <TR>
    <TD colSpan=2><PRE>&lt;service name="Microsoft.ServiceBus.Samples.OnewayService"&gt;
    &lt;endpoint address="" behaviorConfiguration="sharedSecretClientCredentials"
       binding="netOnewayRelayBinding" bindingConfiguration="default"
       name="RelayEndpoint" contract="Microsoft.ServiceBus.Samples.IOnewayContract" /&gt;
&lt;/service&gt;</PRE></TD></TR></TBODY></TABLE></SPAN></DIV>
<P xmlns="">The client is configured with the following endpoint:</P>
<DIV class=code xmlns=""><SPAN codeLanguage="xml">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
  <TBODY>
  <TR>
    <TH>Xml&nbsp;</TH>
</TR>
  <TR>
    <TD colSpan=2><PRE>&lt;client&gt;
    &lt;!-- Application Endpoint --&gt;
    &lt;endpoint name="RelayEndpoint"
        contract="Microsoft.ServiceBus.Samples.IOnewayContract"
        binding="netOnewayRelayBinding"
        bindingConfiguration="default"
        behaviorConfiguration="sharedSecretClientCredentials" 
        address="http://AddressToBeReplacedInCode/" /&gt;
&lt;/client&gt;</PRE></TD></TR></TBODY></TABLE></SPAN></DIV>
<P xmlns="">The address is a placeholder that will be replaced in the 
application.</P></content></DIV>
<H2 class=heading>Building and Running the Sample</H2>
<DIV id=sectionSection2 class=section><content 
xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
<P xmlns="">Before building the solution, perform the following steps to update the 
    App.config files</P>
<OL class=ordered xmlns="">
  <LI>Open the App.config file in the \Service folder, replace &quot;ISSUER_NAME&quot; with 
      &quot;owner&quot; and &quot;ISSUER_SECRET&quot; with the actual issuer secret.<BR><BR>
  <LI>Open the App.config file in the \Client folder, replace &quot;ISSUER_NAME&quot; with &quot;owner&quot; and &quot;ISSUER_SECRET&quot; with the
        actual issuer secret.<BR><BR>
</OL>
    <P xmlns="">After building the solution, do the following to run the 
        application:<OL class=ordered xmlns="">
  <LI>From a command prompt, run the service application from Service\bin\Debug\Service.exe.<BR><BR>
  <LI>When prompted, enter the service namespace. At this point, the service should be 
      running and prints the following text &quot;Press [Enter] to exit&quot;. 
  <BR><BR>
  <LI>From another command prompt, run the client application from Client\bin\Debug\Client.exe.<BR><BR>
  <LI>You will be prompted for the service namespace with which to connect (the 
      service namespace  
      specified in step 2).&nbsp; At this point, the client should start sending 
      messages to the service. Note that by default, the client sends a total of 25 messages. <BR>
      <BR></OL>
</DIV>
    
    <P xmlns="">Did you find this information useful?&nbsp; <a href="http://go.microsoft.com/fwlink/?LinkID=155664">Please send your suggestions and comments about the documentation.</a></P>
    
</BODY></HTML>
